<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        html,body{
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
        #app{
            position: absolute;
            left: 0;
            right: 0;
            top: 0;
            bottom: 0;
            margin: auto;
            width: 200px;
            height: 200px;
        }
    </style>
</head>
<body>
    <div id="app">
        <!--todolist-->
        <input type="text" placeholder="请输入待办任务"
               v-model="todoItem" v-on:change="changeFn">
        <ul>
            <li v-for="item in list">
                {{item}}
            </li>
        </ul>
    </div>
</body>
<script src="./js/vue.js"></script>
<script>
    // 数据驱动: 如何将dom操作转化为对数据的操作
    new Vue({
        el:"#app",
        data:{
            todoItem:"123",
            list:["吃饭","睡觉","玩老付"]
        },
        methods:{
            changeFn(){
                this.list.push(this.todoItem)
                this.todoItem=""
            }
        }
    })
</script>
</html>

